<?

if ($DATA['component']['id']) {
	
	$_record = array('id_data' => D_MB_SETTINGS, 'id_parent' => $DATA['component']['id'], 'assoc' => '');

	$_fields = array(
		'path' => 'catalog', 'w' => 128, 'h' => 96, 'param' => 'id', 'lw' => 400, 'lh' => 300, 
		'gal_path' => 'catalog/gal', 'gal_tn' => FP_TN_DIR, 'gal_w' => 800, 'gal_h' => 600, 'gal_tnw' => 96, 'gal_tnh' => 96,
		'caption' => array('large' => true, 'lang' => true),
	);


	switch (action(array('editor_save'))) {
	
		case 'editor_save':

			dataset('killmeta', "(id_data=".D_MB_SETTINGS.") AND (id_parent={$DATA[component][id]})");
			dataset('savemeta', prepareModel($_fields, $_record));
			
			return true;	// end of component edition
	}
	
	$DATA['settings'] = array_merge($_fields, datafetch_array('loadmeta', D_MB_SETTINGS, 
		array('parent' => $DATA['component']['id'], 'getclob' => true)));
		
	foreach($DATA['langs'] as $lang)
		$DATA['settings']['data'][$lang['text']] = datafetch_array('loadmeta', D_MB_SETTINGS, 
			array('parent' => $DATA['component']['id'], 'assoc' => $lang['text'], 'getclob' => true));
		
	return false;

} else exit;